package 统计算法.行车管理系统;

public class xcglxt {
    public static void main(String[] args) {
        xcglxt xcglxt = new xcglxt(0, 0, 2);
        System.out.println(xcglxt.addCar(1));
        System.out.println(xcglxt.addCar(2));
        System.out.println(xcglxt.addCar(3));


    }
    static int[] cache = new int[3];
    public xcglxt(int big, int medium, int small) {
        cache[0] = big;
        cache[1] = medium;
        cache[2] = small;
    }

    public boolean addCar(int carType) {
        if (xcglxt.cache[carType-1] >= 1){
            --xcglxt.cache[carType-1];
            return true;
        }else {
            return false;
        }
    }
}
